package userHelp

import (
	myredis "common/redis"
)

var g_tbl_member_info = "tbl_member_info:"

type TblMemberInfo struct {
	Uid               string  `json:"uid" db:"uid" cbor:"uid"`
	EnableLuckyPoint  float64 `json:"enable_lucky_point" db:"enable_lucky_point" cbor:"enable_lucky_point"`
	ExpiredLuckyPoint float64 `json:"expired_lucky_point" db:"expired_lucky_point" cbor:"expired_lucky_point"`
	UsedLuckyPoint    float64 `json:"used_lucky_point" db:"used_lucky_point" cbor:"used_lucky_point"`
}

func GetUsedLuckyPoint(uid string) float64 {
	LoadUserToRedis(uid)
	return myredis.GetUserFieldFloat64(uid, g_tbl_member_info+"used_lucky_point")
}

func AddUsedLuckyPoint(uid string, fValue float64) {
	LoadUserToRedis(uid)
	myredis.AddUserFieldValueByFloat64(uid, g_tbl_member_info+"used_lucky_point", fValue)
}

func GetExpiredLuckyPoint(uid string) float64 {
	LoadUserToRedis(uid)
	return myredis.GetUserFieldFloat64(uid, g_tbl_member_info+"expired_lucky_point")
}
func AddExpiredLuckyPoint(uid string, fValue float64) {
	LoadUserToRedis(uid)
	myredis.AddUserFieldValueByFloat64(uid, g_tbl_member_info+"expired_lucky_point", fValue)
}

func GetEnableLuckyPoint(uid string) float64 {
	LoadUserToRedis(uid)
	return myredis.GetUserFieldFloat64(uid, g_tbl_member_info+"enable_lucky_point")
}

func AddEnableLuckyPoint(uid string, fValue float64) {
	LoadUserToRedis(uid)
	myredis.AddUserFieldValueByFloat64(uid, g_tbl_member_info+"enable_lucky_point", fValue)
}
